﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace HY.BLL.oa
{
 public    class bookmarks
    {

     public static DataTable get_list(string us)
     {
         string sqltxt = "select * from bookmarks where bnm='"+us+"'   ";

         sqltxt = sqltxt + " order by sid desc ";
         DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
         return dt;
     }

     

     public static DataTable get_list(string us,string whe)
     {
         string sqltxt = "select * from bookmarks where bnm='" + us + "'   ";
         if (whe != "") sqltxt =sqltxt+ " and " + whe;

          sqltxt = sqltxt + " order by sid desc ";
         DataTable dt = DAL.DbHelperSQL.SqlDataAdapter(sqltxt);
         return dt;
     }


     public static int ins_task(string user,string website,string memo )
     {
         string sqltxt = "insert into bookmarks values(N'" + user + "',N'" + website + "',N'" + memo + "')  ";

         return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
      
     }

     public static int ups_task(string sid,string user, string website, string memo)
     {
         string sqltxt = "update bookmarks set bnm=N'" + user + "',website=N'" + website + "',remark=N'" + memo + "' where sid=" + sid + "  ";

         return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);

     }

     /// <summary>
     /// 删除一条数据
     /// </summary>
     public static int DeleteList(string sidlist)
     {
         string sqltxt = "delete bookmarks where sid in(" + sidlist + ") ";
         return DAL.DbHelperSQL.ExecuteNonQuery(sqltxt);
     }

    }
}
